/*****************************************************************
File name   : api_judge.h
Author      : liukaihua 
Version     : Ver1.0.0
Date        : 2022-06-10
Description : 关于报警相关的一些状态读取
Others      : 
History     : 
    1. Date:
       Author: ID:
       Modification:
    2. ...
*****************************************************************/

#ifndef __API_JUDGE_H_
#define __API_JUDGE_H_

#include "gd32f30x.h"


/*******************************热断器报警管脚************************************/
#define FT1_RDQBJ_PIN												 	GPIO_PIN_0
#define FT1_RDQBJ_GPIO_PORT                   GPIOD
#define FT1_RDQBJ_GPIO_CLK                    RCU_GPIOD

#define FT2_RDQBJ_PIN												 	GPIO_PIN_1
#define FT2_RDQBJ_GPIO_PORT                   GPIOD
#define FT2_RDQBJ_GPIO_CLK                    RCU_GPIOD

#define EHP_RDQBJ_PIN												 	GPIO_PIN_5
#define EHP_RDQBJ_GPIO_PORT                   GPIOA
#define EHP_RDQBJ_GPIO_CLK                    RCU_GPIOA

#define BLOOD1_RDQBJ_PIN											GPIO_PIN_7//GPIO_PIN_6
#define BLOOD1_RDQBJ_GPIO_PORT                GPIOA
#define BLOOD1_RDQBJ_GPIO_CLK                 RCU_GPIOA

#define BLOOD2_RDQBJ_PIN											GPIO_PIN_6//GPIO_PIN_7
#define BLOOD2_RDQBJ_GPIO_PORT                GPIOA
#define BLOOD2_RDQBJ_GPIO_CLK                 RCU_GPIOA

#define RESET_RDQBJ_PIN												GPIO_PIN_14
#define RESET_RDQBJ_GPIO_PORT                 GPIOD
#define RESET_RDQBJ_GPIO_CLK                  RCU_GPIOD



#define RDQn																	5//热断器报警的通道数
#define FT1_channel														0
#define FT2_channel														1
#define EHP_channel														2
#define BLOOD1_channel												3
#define BLOOD2_channel												4

#define SHOROVn																	5//短路或过载报警的通道数
#define OFFn																	  5//脱落检测的通道数

/*******************************短路或过载报警管脚************************************/
#define FT1_SHOROVBJ_PIN												 GPIO_PIN_11
#define FT1_SHOROVBJ_GPIO_PORT                   GPIOD
#define FT1_SHOROVBJ_GPIO_CLK                    RCU_GPIOD

#define FT2_SHOROVBJ_PIN												 GPIO_PIN_15
#define FT2_SHOROVBJ_GPIO_PORT                   GPIOB
#define FT2_SHOROVBJ_GPIO_CLK                    RCU_GPIOB

#define EHP_SHOROVBJ_PIN												 GPIO_PIN_8
#define EHP_SHOROVBJ_GPIO_PORT                   GPIOD
#define EHP_SHOROVBJ_GPIO_CLK                    RCU_GPIOD

#define BLOOD1_SHOROVBJ_PIN											 GPIO_PIN_10//GPIO_PIN_9
#define BLOOD1_SHOROVBJ_GPIO_PORT                GPIOD
#define BLOOD1_SHOROVBJ_GPIO_CLK                 RCU_GPIOD

#define BLOOD2_SHOROVBJ_PIN											 GPIO_PIN_9//GPIO_PIN_10
#define BLOOD2_SHOROVBJ_GPIO_PORT                GPIOD
#define BLOOD2_SHOROVBJ_GPIO_CLK                 RCU_GPIOD

#define RESET_SHOROVBJ_PIN											 GPIO_PIN_15
#define RESET_SHOROVBJ_GPIO_PORT                 GPIOD
#define RESET_SHOROVBJ_GPIO_CLK                  RCU_GPIOD


/*******************************设备脱落检测管脚************************************/
#define FT1_OFFBJ_PIN												 GPIO_PIN_13
#define FT1_OFFBJ_GPIO_PORT                  GPIOB
#define FT1_OFFBJ_GPIO_CLK                   RCU_GPIOB

#define FT2_OFFBJ_PIN												 GPIO_PIN_13
#define FT2_OFFBJ_GPIO_PORT                  GPIOB
#define FT2_OFFBJ_GPIO_CLK                   RCU_GPIOB

#define EHP_OFFBJ_PIN												 GPIO_PIN_10
#define EHP_OFFBJ_GPIO_PORT                  GPIOB
#define EHP_OFFBJ_GPIO_CLK                   RCU_GPIOB

#define BLOOD1_OFFBJ_PIN											GPIO_PIN_12//GPIO_PIN_11
#define BLOOD1_OFFBJ_GPIO_PORT                GPIOB
#define BLOOD1_OFFBJ_GPIO_CLK                 RCU_GPIOB

#define BLOOD2_OFFBJ_PIN											GPIO_PIN_11//GPIO_PIN_12
#define BLOOD2_OFFBJ_GPIO_PORT                GPIOB
#define BLOOD2_OFFBJ_GPIO_CLK                 RCU_GPIOB


/*********************************热断器报警状态************************************/
typedef enum
{
	BREAK_NORMAL = 0, //热断器正常状态
	BREAK_RESET_START , //热断器复位开始状态
	BREAK_RESET_END,  //热断器复位结束状态
}BREAK_STA_en;

/*********************************短路或过载报警状态************************************/
typedef enum
{
	SHOROV_NORMAL = 0, //短路或过载正常状态
	SHOROV_RESET_START , //短路或过载复位开始状态
	SHOROV_RESET_END,  //短路或过载复位结束状态
}SHOROV_STA_en;




uint32_t RDQsta_get(uint8_t channel);
void equBJ_init(void);
uint32_t SHorOVsta_get(uint8_t channel);
uint32_t EquOffsta_get(uint8_t channel);
void RDQ_SHOROVBJ_rstend(void);


#endif
/* [] END OF FILE */
